// let myDate = new Date();
// let dd = Date.parse(myDate);
export function times (timestamp, str) {
  var date = new Date(timestamp); //  时间戳为10位需*1000，时间戳为13位的话不需乘1000
  let Y = date.getFullYear() + '-';
  let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  let D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate();
  let h = str;
  return Y + M + D + " " + h;
}
export function getNowFormatDate () {
  var date = new Date();
  var seperator1 = "-";
  var seperator2 = ":";
  var month = date.getMonth() + 1;
  var strDate = date.getDate();
  var hoursDate = date.getHours();
  var minutes = date.getMinutes();
  var seconds = date.getSeconds();
  if (month >= 1 && month <= 9) {
    month = "0" + month;
  }
  if (strDate >= 0 && strDate <= 9) {
    strDate = "0" + strDate;
  }
  if (hoursDate >= 0 && hoursDate <= 9) {
    hoursDate = "0" + hoursDate;
  }
  if (minutes >= 0 && minutes <= 9) {
    minutes = "0" + minutes;
  }
  if (seconds >= 0 && seconds <= 9) {
    seconds = "0" + seconds;
  }
  var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate + " " + hoursDate + seperator2 + minutes + seperator2 + seconds;
  return currentdate;
}

export function getDates () {
  var date = new Date();
  var seperator1 = "-";
  // var seperator2 = ":";
  var month = date.getMonth() + 1;
  var strDate = date.getDate();
  if (month >= 1 && month <= 9) {
    month = "0" + month;
  }
  if (strDate >= 0 && strDate <= 9) {
    strDate = "0" + strDate;
  }

  var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
  return currentdate;
}

export function spliceDate () {
  var date = new Date();
  var week = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  // var seperator1 = "-";
  // var seperator2 = ":";
  var month = date.getMonth() + 1;
  // var strDate = date.getDate();
  // if (month >= 1 && month <= 9) {
  //   month = "0" + month;
  // }
  // if (strDate >= 0 && strDate <= 9) {
  //   strDate = strDate;
  // }

  var currentdate = date.getFullYear() + '年' + ' ' + month + '月' + ' ' + week[date.getDay()];
  return currentdate;
}
